<template>
  <div>
    <a-card :bordered="false">
      <f-search-form :more="false" @searchHandler="searchHandler">
        <f-search-form-item label="项目代码" name="projectCode" />
        <f-search-form-item label="项目名称" name="projectName" />
      </f-search-form>
      <f-table
        style="margin-top:60px"
        ref="table"
        size="default"
        rowKey="roleId"
        :columns="columns"
        :multiple="false"
        :params="queryParam"
        :api="api.bwbsIndex"
        @change="handleChange"
      >
        <span slot="action" slot-scope="text, record">
          <template>
            <a @click="$refs.drawer.showDrawer(record)" >同步到sap</a>
            <a-divider type="vertical" />
          </template>
        </span>
      </f-table>
      <bwb-drawer ref="drawer"></bwb-drawer>
    </a-card>
  </div>
</template>
<script>
  import bwbDrawer from './bwb_drawer.vue'
  import api from './js/apiIndex'

  export default {
    name: 'TableList',
    components: {
      bwbDrawer
    },
    data() {
      let me = this
      return {
        api: Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {},
        // dataSource: [
        //   { projectCode: 'YB110', projectName: '这是项目一', versionName: '提交人', version: '100.00', endTime: '2020-1-22 7:55:22' },
        //   { projectCode: 'YB111', projectName: '这是项目二', versionName: '提交人', version: '100.01', endTime: '2020-1-22 7:55:22' },
        //   { projectCode: 'YB112', projectName: '这是项目三', versionName: '提交人', version: '100.01', endTime: '2020-1-22 7:55:22' },
        //   { projectCode: 'YB113', projectName: '这是项目四', versionName: '提交人', version: '100.03', endTime: '2020-1-22 7:55:22' }
        // ],
        // 表头
        columns: [
          {
            title: '项目编码',
            align: 'center',
            width: 130,
            sorter: (a, b) => a.projectCode.length - b.projectCode.length,
            dataIndex: 'projectCode'
          },
          {
            title: '项目名称',
            align: 'left',
            sorter: (a, b) => a.projectName.length - b.projectName.length,
            dataIndex: 'projectName'
          },
          {
            title: '版本号',
            align: 'center',
            sorter: (a, b) => a.bigVersion.length - b.bigVersion.length,
            dataIndex: 'ver'
          },
          {
            title: '最近一次版本提交时间',
            sorter: (a, b) => a.bigVersion.length - b.bigVersion.length,
            dataIndex: 'updateTime'
          },
          {
            title: '操作',
            dataIndex: 'action',
            width: 370,
            scopedSlots: { customRender: 'action' }
          }
        ]
      }
    },
    created() {
      this.queryParam['isReport'] = false
      this.queryParam = this.detailsParams
    },
    methods: {
    }
  }
</script>
